package com.persia.service;

import com.persia.dao.BookDao;
import com.persia.domain.TechBook;
import com.persia.exception.InValidValueException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author caibosi
 * @created 2014-02-10
 */
@Service
public class BookService {

    private static final Logger logger = LoggerFactory.getLogger(BookService.class);

    @Resource
    private BookDao bookDao;

    public void insert(TechBook book){
       bookDao.create(book);
        throw new InValidValueException("test");
    }

    public List<TechBook> getAll(){
        return bookDao.findByHql("from TechBook",null);
    }


}
